package com.example.idachuappone.index.dto;

import android.content.Context;
import com.example.idachuappone.cook.entity.CookResult;
import org.json.JSONObject;

public class CookDto {
    public CookResult getCookResult(Context context, String json) throws Exception {
        JSONObject jsonObject = new JSONObject(json);
        if (jsonObject.getInt("code") == 10000) {
            return new CookResult().parseJson(jsonObject.getJSONObject("data"));
        }
        throw new Exception(jsonObject.getString("error"));
    }
}
